<?php

namespace common\models\myhtsq;

use common\models\BaseModel;

/**
 * Description of ContractPaymentModel
 * 合同回款统一model
 * @author chenxc
 */
class ContractPaymentModel extends BaseModel
{
    public $DhkGUID;
    public $payment_id;
    public $contract_id;
    public $finance_code;
    public $register_date;
    public $payment_amount;
    public $payment_date;
    public $input_date;
    public $payment_code;
    public $receivables_account;
    public $receivables_account_name;
    public $payment_account_name;
    public $remark;
    public $created_on;
    public $created_by;
    public $modified_on;
    public $modified_by;
    public $pay_way;
    public $withdraw_fee;
    public $withdraw_fee_rate;


    /**
     * 回款与发票及应收款对应关系(这里是个数组)
     * @var [common\models\myhtsq\InvoicePayment]
     */
    public $invoicePayments;

    public function __construct($config = array())
    {
        parent::__construct($config);
    }

    public function rules()
    {
        return [
            [['register_date', 'payment_date', 'created_on', 'modified_on', 'invoicePayments','input_date', 'pay_way', 'withdraw_fee', 'withdraw_fee_rate'], 'safe', 'on' => 'savecontractpayment'],
            [['payment_amount'], 'number', 'on' => 'savecontractpayment'],
            [['payment_amount'], 'default', 'value' => 0, 'on' => 'savecontractpayment'],
            [['remark'], 'string', 'on' => 'savecontractpayment'],
            [['DhkGUID', 'payment_id', 'contract_id', 'created_by', 'modified_by'], 'string', 'max' => 36, 'on' => 'savecontractpayment'],
            [['finance_code', 'payment_code', 'receivables_account'], 'string', 'max' => 50, 'on' => 'savecontractpayment'],
            [['receivables_account_name', 'payment_account_name'], 'string', 'max' => 100, 'on' => 'savecontractpayment']
        ];
    }
}
